package org.jeecg.modules.fk.controller.inner;


import org.jeecg.modules.fk.core.rest.RestResponse;
import org.jeecg.modules.fk.service.FxmxService;
import org.jeecg.modules.fk.service.RiskOldNewService;
import org.jeecg.modules.fk.vo.inner.req.*;
import org.jeecg.modules.fk.vo.inner.resp.*;
import org.jeecg.modules.fk.vo.old_new.RiskOldNewGroupVO;
import org.jeecg.modules.fk.vo.old_new.RiskOldNewVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class IfifkInnerResource {

    @Resource
    private RiskOldNewService riskOldNewService;

    @Resource
    private FxmxService fxmxService;

    /**
     * 通过旧的 指标编码（税检宝） 获取新的数据
     *
     * @param dto
     * @return RestResponse<CashTransStatusResDTO>
     */
    public RestResponse<QueryZbByOldRespDTO> queryZbByOld(QueryZbByOldReqDTO dto) {
        Map<String, RiskOldNewVO> resultMap = this.riskOldNewService.queryZbByOld(dto.getZbbmList());

        QueryZbByOldRespDTO queryZbByOldRespDTO = new QueryZbByOldRespDTO();
        queryZbByOldRespDTO.setMap(resultMap);
        return RestResponse.successData(queryZbByOldRespDTO);
    }


    /**
     * 通过类型分组数据
     *
     * @param dto
     * @return RestResponse<CashTransStatusResDTO>
     */
    public RestResponse<GroupZbByTypeRespDTO> groupZbByType(GroupZbByTypeReqDTO dto) {
        List<RiskOldNewGroupVO> list = this.riskOldNewService.groupZbByType(dto.getZbType());

        GroupZbByTypeRespDTO reuslt = new GroupZbByTypeRespDTO();
        reuslt.setList(list);
        return RestResponse.successData(reuslt);
    }

    /**
     * 通过税号，风险类别、风险起、止时间获取风险明细,结论，测检得分
     *
     * @param dto
     * @return
     */
    public RestResponse<FxmxFlByNsrsbhRespDTO> fxmxFlByNsrsbh(FxmlFlByNsrsbhReqDTO dto) {
        FxmxFlByNsrsbhRespDTO result = this.fxmxService.getFxmxByNsrsbh(dto.getZbType(), dto.getNsrsbh(), dto.getSkssqq(), dto.getSkssqz());
        return RestResponse.successData(result);
    }


    /**
     * 通过税号、风险类型、起止时间List，返回风险报告生成记录
     *
     * @param dto
     */
    public RestResponse<RiskProcessListRespDTO> getRiskProcessRecord(GetLocalRiskRecordReqDTO dto) {
        RiskProcessListRespDTO result = this.fxmxService.getRiskProcessRecord(dto);
        return RestResponse.successData(result);
    }


    public RestResponse<LastRiskProcessRespDTO> getLastRiskProcessRecord(GetLastRiskRecordReqDTO dto) {
        LastRiskProcessRespDTO result = this.fxmxService.getLastRiskProcessRecord(dto);
        return RestResponse.successData(result);
    }


    public RestResponse<LastRiskReportTimeRespDTO> getLastRiskReportTime(GetLastRiskReportReqDTO dto) {
        LastRiskReportTimeRespDTO result = this.fxmxService.getLastRiskReportTime(dto);
        return RestResponse.successData(result);
    }

}